﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DryWCS.App.ViewModel
{
    public class MsgBoxViewModel : ViewModelBase
    {
        public bool Result { get; set; }

        private string icon;
        public string Icon
        {
            get { return icon; }
            set
            {
                icon = value;
                this.RaisePropertyChanged("Icon");
            }
        }


        private string msg;
        public string Msg
        {
            get { return msg; }
            set
            {
                msg = value;
                this.RaisePropertyChanged("Msg");
            }
        }


        private string color;
        public string Color
        {
            get { return color; }
            set
            {
                color = value;
                this.RaisePropertyChanged("Color");
            }
        }


        private bool btnHide;
        public bool BtnHide
        {
            get { return btnHide; }
            set
            {
                btnHide = value;
                this.RaisePropertyChanged("BtnHide");
            }
        }


        private RelayCommand cancelCommand;
        private RelayCommand saveCommand;

        public RelayCommand CancelCommand
        {
            get
            {
                if (cancelCommand == null)
                {
                    cancelCommand = new RelayCommand(Cancel);
                }

                return cancelCommand;
            }
        }


        public RelayCommand SaveCommand
        {
            get
            {
                if (saveCommand == null)
                {
                    saveCommand = new RelayCommand(Save);
                }

                return saveCommand;
            }
        }


        /// <summary>
        /// 取消
        /// </summary>
        public void Cancel()
        {
            Result = false;
            Messenger.Default.Send("", "DialogClose");
           // Messenger.Default.Send(Result, "DialogClose");
        }


        public void Save()
        {
            Result = true;
            Messenger.Default.Send("", "DialogClose");
        }

    }
}
